]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
remoteMenu: Add support for extended accessibility roles
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 9 May 2013 20:24:40 +0000 (16:24 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 13 May 2013 22:34:26 +0000 (18:34 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=700257

js/ui/remoteMenu.js

index 0e2fdf2802f2f1b617f032c68cdaa27ecccfb839..d03ed63b615857239c99c97a91c3bd34d7b227da 100644 (file)
@@ -1,5 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
+const Atk = imports.gi.Atk;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const Gio = imports.gi.Gio;
@@ -29,12 +30,12 @@ const RemoteMenuItemMapper = new Lang.Class({
 
         this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel));
         this._trackerItem.connect('notify::sensitive', Lang.bind(this, this._updateSensitivity));
-        this._trackerItem.connect('notify::role', Lang.bind(this, this._updateDecoration));
+        this._trackerItem.connect('notify::role', Lang.bind(this, this._updateRole));
         this._trackerItem.connect('notify::toggled', Lang.bind(this, this._updateDecoration));
 
         this._updateLabel();
         this._updateSensitivity();
-        this._updateDecoration();
+        this._updateRole();
 
         this.menuItem.connect('destroy', function() {
             trackerItem.run_dispose();
@@ -63,6 +64,18 @@ const RemoteMenuItemMapper = new Lang.Class({
 
         this.menuItem.setOrnament(ornament);
     },
+
+    _updateRole: function() {
+        let a11yRoles = {};
+        a11yRoles[ShellMenu.MenuTrackerItemRole.NORMAL] = Atk.Role.MENU_ITEM;
+        a11yRoles[ShellMenu.MenuTrackerItemRole.RADIO] = Atk.Role.RADIO_MENU_ITEM;
+        a11yRoles[ShellMenu.MenuTrackerItemRole.CHECK] = Atk.Role.CHECK_MENU_ITEM;
+
+        let a11yRole = a11yRoles[this._trackerItem.role];
+        this.menuItem.actor.accessible_role = a11yRole;
+
+        this._updateDecoration();
+    },
 });
 
 const RemoteMenu = new Lang.Class({